$(document).ready(function(){
    $("#btn_add").click(function(){
    	art.dialog({
    		title:"添加产品",//对话框标题
    		content:document.getElementById('add_category'),//对话框内容 可以使用getElementById,getElementByTagName 方式获取内容添加到弹出框内
    		width:'auto',
    		height:'auto',
    		padding: '20px 0 0 0', //内容与边界距离
    		fixed:true, //锁定 不会随着滚动条的滑动而滚动
    		lock: true, //锁定 弹出框出现后与外部断开联系 一般用于重要的提示
    		background: 'black', // 背景色
    		opacity: 0.7,	// 透明度
    		okVal:'提交',
    		   open: function () {  
                KindEditor.create('#product_content', {  
                    resizeType: 0,  
                    allowPreviewEmoticons: false,  
                    allowImageUpload: false,  
                    afterBlur: function () {  
                        this.sync();  
                    },  
                    items: [  
'source', 'selectall', 'quickformat', '|', 'fontname', 'fontsize', '|', 'undo', 'redo', 'cut', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'lineheight', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'image', 'link']  
                });  
        },
     		ok:function()
    		{
    		    var model_select = $("#model_select").val();  
    		    var cate_select  = $("#cate_select").val();  
    		    var cate_name    = $("#cate_name").val();
    		    var cate_dir     = $("#cate_dir").val();
    		    var navigation   = $('input:radio[name="navigation"]:checked').val();
    		    $.ajax({
    		    	type:"POST",
    		    	url :ajax_add_cate,
    		    	datatype:"json",
    		    	data:{'model_select':model_select,'cate_select':cate_select,'cate_dir':cate_dir,'cate_name':cate_name,'navigation':navigation},
	    		    success:function(msg)
	    		    {
    		    	  if(msg)
    		    	  {
    		    		  window.location.href=myurl;
	        			  $.dialog.tips('添加成功！', 1.5);
    		    	  }else
    		    	  {
    		    		  window.location.href=myurl;
	        			  $.dialog.tips('添加失败！', 1.5);
    		    	  }
    		    	   
			        }
    		    })
    		}
    	})
    }),
    $("#all_check").click(function(){
    	if($("input[type='checkbox']").attr("checked")=="checked")
    	{
    		$("input[type='checkbox']").attr("checked",'true');
    	}else
    	{
    		$("input[type='checkbox']").attr("checked",false);
    	}
    	
    })
   
});